#include <iostream>
#include <fstream>
#include "sf_rc.h"

using namespace std;
using namespace skyfire;

int main()
{
    string password = "nihaoshijie";

    sf_rc rc(password);
    ifstream fi("/home/skyfire/Desktop/img.png", ios::in | ios::binary);
    ofstream fo("/home/skyfire/Desktop/img2.png", ios::out | ios::binary);
    cout<<rc.enc(&fi, &fo);
    fi.close();
    fo.close();

    sf_rc rc2(password);
    ifstream fi2("/home/skyfire/Desktop/img2.png", ios::in | ios::binary);
    ofstream fo2("/home/skyfire/Desktop/img3.png", ios::out | ios::binary);

    cout<<rc2.dec(&fi2, &fo2);
    fi2.close();
    fo2.close();



    sf_rc rc3(password);
    auto enc_data = rc3.enc(str2bytearray("hello world\nhello world\n"));
    sf_rc rc4(password);
    auto dec_data = bytearray2str(rc4.dec(enc_data));
    cout<<dec_data<<endl;

}
